package com.zhl.emp_manage.test;

import java.nio.ByteBuffer;

public class OutOfMemoryError_DirectBufferMemory {
    public static void main(String[] args) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        // -XX:MaxDirectMemorySize=5m  我们配置为5MB，但实际使用6MB，故意破坏
        ByteBuffer bb = ByteBuffer.allocateDirect(6 * 1024 * 1024);
    }
}